<!DOCTYPE html>
<html lang="zh-Hans-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    html,
    body {
      height: 100%;
      padding: 0;
      margin: 0;
    }

    .chart {
      height: 100%;
      width: 100%;
      overflow: hidden;
    }

    * {
      box-sizing: border-box;
    }

    #root {
      height: 100%;
      overflow: hidden;
      border: 1px solid red;
      display: flex;
      flex-direction: column;
    }

    .item {
      width: 100%;
    }

    #root .item:nth-of-type(1) {
      height: 10%;
      border: 1px solid gray;
    }

    #root .item:nth-of-type(2) {
      height: 20%;
      border: 1px solid palegreen;
    }


    /* 高度不明确时，需要设置height为0 滚动条才会生效 */
    #root .item:nth-of-type(3) {
      flex-grow: 1;
      height: 0;
      border: 1px solid royalblue;
      overflow: hidden;
    }

    #root .item:nth-of-type(3) .w {
      height: 100%;
      overflow: auto;
    }

    #root .item:nth-of-type(3) .w>div {
      height: 100px;
    }
  </style>
</head>

<body>
  <div id="root">
    <div class="item"></div>
    <div class="item"></div>
    <div class="item">
      <div class="w">
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
        <div>111</div>
      </div>
    </div>
  </div>
</body>

</html>